package cn.com.jslh.boarpro.main.view;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.blankj.utilcode.util.SPUtils;

import org.json.JSONException;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.com.jslh.boarpro.R;
import cn.com.jslh.boarpro.base.BaseApplication;
import cn.com.jslh.boarpro.main.presenter.NewsWarnPresenterImpl;
import cn.com.jslh.boarpro.util.WebService;

public class NewsWarnActivity extends AppCompatActivity {
    @BindView(R.id.recycle_news_warn)
     RecyclerView recyclerView;
    @BindView(R.id.toolbar_warn_news)
    Toolbar toolbar;
    private NewsWarnPresenterImpl presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_warn);
        ButterKnife.bind(this);
        setSupportActionBar(toolbar);

        initUI();

    }

    private void initUI(){
        StaggeredGridLayoutManager layoutManager=new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
        presenter=new NewsWarnPresenterImpl(NewsWarnActivity.this,recyclerView);
        presenter.getData(SPUtils.getInstance().getString(BaseApplication.FLINEID));
//        presenter.getData("kvYAAABMvoYB5Kp+");
    }

    @OnClick(R.id.back_warn_news)
    public void onViewClicked(){
        this.finish();
    }



    public void getData(WebService.NetSuccessListener netSuccessListener){
        new WebService.Builder(NewsWarnActivity.this,"TotalWarnList","WSPigWarnFacade")
                .addProperty("lineID","kvYAAABrJIcB5Kp+")
                .success(netSuccessListener)
                .post();
    }




}
